public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }

    /**
     * 提莫攻击
     * @param timeSeries
     * @param duration
     * @return
     */
    public static int findPoisonedDuration(int[] timeSeries, int duration) {
        int n=timeSeries.length;
        int sum=n*duration;
        for(int i=0;i<n-1;i++){
            if(timeSeries[i]+duration-1>=timeSeries[i+1]){
                sum-=duration-(timeSeries[i+1]-timeSeries[i]);
            }
        }
        return sum;
    }
}